//
//  LLYTSmallUtil.h
//  huafeibao
//
//  Created by xuyf on 13-6-6.
//  Copyright (c) 2013年 ZPP. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "UIView+Sizes.h"

#define is_Retina ([[UIScreen mainScreen] scale] > 1)
#define is_iPhone6P ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define is_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#ifdef DEBUG
#define LLDDLog(...) NSLog(__VA_ARGS__)
#define LLDDMethod() NSLog(@"%s", __func__)
//#define DLog(fmt, ...) (NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__));
#define LLDLog(fmt, ...) (NSLog((@"%@" fmt), @"", ##__VA_ARGS__));

#else
#define LLDDLog(...)
#define LLDMethod()
#define LLDLog(fmt, ...)
#endif

@interface LLYTSmallUtil : NSObject

+ (int)iOSBigVersion;

+ (CGFloat)tableCutHeight;

+(BOOL)hasNextPage:(NSDictionary *)dic;

+(NSString *)getNextPageNo:(NSString *)currentPageNo;
@end

@interface UIColor (CreatorAdditon)

// r, g, b 使用0~255的数值, alpha 0~1
+ (UIColor*)colorWithR:(float)r G:(float)g B:(float)b A:(float)a;

// #FF123312 每两位分别代表 R G B alpha, TODO: 暂未支持短写 #F12这种
// 已经支持 red, yellow 等英文颜色值
+ (UIColor*)colorWithHTMLStr:(NSString*)htmlRGBString;

@end

@interface NSObject (safePerformSelector)

- (id)safePerformSelector:(SEL)aSelector;
- (id)safePerformSelector:(SEL)aSelector withObject:(id)object;
- (id)safePerformSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
@end

@interface UIButton (easyAccess)

- (void)setLongSelector:(SEL)selector withTarget:(id)target;

- (void)setSelector:(SEL)selector withTarget:(id)target;

- (void)setTitle:(NSString*)title;

- (void)setImage:(UIImage *)image;
- (void)setBackgroundImage:(UIImage *)image;

- (void)centerImageAndTitle;  

@end

@interface UIImage (SDKBundle)

+ (UIImage*)sdkBundleImageNamed:(NSString*)imageName;

@end

@interface UIImageView (easyAccess)

+ (UIImageView*)imageViewWithName:(NSString*)imageName;

@end

@interface UIView (Alignment)

- (void)adjustViewLineCenter:(UIView*)subwidget;

@end

@interface NSObject(json)

- (NSString*)jsonString;

@end